/*  ----------------------------------------------------------------------------
 *  Arello Mobile
 *  Fast 3d Engine
 *  ----------------------------------------------------------------------------
 * Except where otherwise noted, this work is licensed under
 * http://creativecommons.org/licenses/by/3.0
 */
#pragma once

#include <Config.h>
#include <string>
#include <NoCopy.h>
#include <threads/Thread.h>
#include <threads/Lock.h>
#include <Creator.h>
#include <win32/win32.h>
#include <WindowCreator.h>
#include <Synchronizer.h>
#include <CompilerFeatures.h>

namespace liba
{

class WindowImpl;
//class InputCreatorWindows;

class ApplicationWindowed : 
	virtual public Creator,
	virtual public WindowCreator,
	public Synchronizer, 
	private WindowMessageListener
{	
	std::string caption;
protected:
	bool active;

	bool termination_requested;

	void set_property( const std::string & nam, int val );
	void set_focus();
public:
	virtual int window_proc( unsigned msg, unsigned wParam, unsigned lParam ) LIBA_OVERRIDE;

	explicit ApplicationWindowed(const std::string & caption, const std::string & cmd_line);
	ApplicationWindowed(const std::string & caption, int sx, int sy, bool resizeable);
	virtual ~ApplicationWindowed();

	virtual bool LifeCycle( time_float delta_time );
	virtual bool render()
	{
		return false;
	}
	int start();
	static int get_good_start_result()
	{
		return 2000000000;
	}
	const std::string & get_caption()const
	{
		return caption;
	}

	virtual void Synchronize(const boost::function<void ()>& fn) LIBA_OVERRIDE;
	virtual void Schedule(const boost::function<void ()>& fn) LIBA_OVERRIDE;
};

} // namespace liba
using namespace liba;
